Fk:loadTranslationTable{
  ["plum__shuangjian_derive"] = "霜简",
  [":plum__shuangjian_derive"] = "你可以将中央区内的一张即时牌置于牌堆顶，视为使用或打出之。" ..
  "<br/><span style='font-size: smaller;'><font color='gray'>衍生效果</font></span>"
}

local DIY = require "packages/diy_utility/diy_utility"

local function isImmediate(id)
  return Fk:getCardById(id).type == Card.TypeBasic or Fk:getCardById(id):isCommonTrick()
end

local skill = fk.CreateSkill{
  name = "plum__shuangjian_derive",
}

skill:addEffect("viewas", {
  pattern = ".|.|.|.|.|basic,trick",
  prompt = "#plum__shuangjian",
  expand_pile = function (self, player)
    return DIY.getCenterCards(Fk:currentRoom())
  end,
  card_filter = function (self, player, to_select, selected)
    return #selected == 0 and isImmediate(to_select) and table.contains(DIY.getCenterCards(Fk:currentRoom()), to_select)
  end,
  view_as = function (self, player, cards)
    if #cards == 0 then return end
    local to_use = Fk:cloneCard(Fk:getCardById(cards[1]).name)
    to_use.skillName = "plum__shuangjian"
    to_use:addFakeSubcards(cards)
    return to_use
  end,
  before_use = function (self, player, use)
    local room = player.room
    room:moveCards({
      ids = use.card.fake_subcards,
      from = player,
      toArea = Card.DrawPile,
      moveReason = fk.ReasonPut,
      skillName = "plum__shuangjian",
      proposer = player,
      moveVisible = true,
    })
  end,
})

return skill